//优先队列 + 贪心
class Solution {
public:
    int halveArray(vector<int>& nums) {
        int count = 0;
        double sum = 0;
        priority_queue<double> max;
        for (auto& i : nums)
        {
            sum += i;
            max.push(i);
        }

        double sub = 0;
        double target = sum / 2;
        while (sub < target)
        {
            double top = max.top();
            max.pop();
            max.push(top / 2);
            sub += top / 2;

            count++;
        }

        return count;
    }
};